package leecode

func change(amount int, coins []int) int {
	dp := make([]int, amount+1) //i元钱有dp[i]中方法
	//dp数组初始化
	dp[0] = 1
	for _, coin := range coins {
		for i := coin; i <= amount; i++ {
			dp[i] = dp[i-coin] + dp[i]
		}
	}
	return dp[len(dp)-1]
}
